﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Windows.Controls.Primitives;

namespace eventr.Controls
{
    /// <summary>
    /// Toggle button wasn't working as predicted, Checked property had problems when bound.
    /// This control gets around this problem
    /// </summary>
    public class CustomToggleButton : ToggleButton
    {
        static readonly DependencyProperty SpecialIsCheckedProperty;

        public bool SpecialIsChecked
        {
            get
            {
                return (bool)GetValue(SpecialIsCheckedProperty);
            }
            set
            {
                SetValue(SpecialIsCheckedProperty, value);
            }
        }

        static CustomToggleButton()
        {
            SpecialIsCheckedProperty = DependencyProperty.Register("SpecialIsChecked", typeof(bool), typeof(CustomToggleButton), new PropertyMetadata(false, (s, e) =>
            {
                (s as CustomToggleButton).IsChecked = (bool)e.NewValue;
            }));
        }
    }
}
